﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _02_NumbersInAscendingOrder
{
    class Program
    {
        static int ReadNumber(int start, int end)
        {
            Console.WriteLine("Enter a number in the given range {0}:{1}",start, end);
            int number = int.Parse(Console.ReadLine());
            if (number < start || number > end )
	        {
                throw new ArgumentOutOfRangeException("Your number is not int range");
	        }
            return number;
        }
        static void Main(string[] args)
        {
            int counter = 0;
            int start = int.MinValue;
            int end = 100;

            while (counter < 10)
            {
                try
                {
                    start = ReadNumber(start, end);
                    counter++;
                }
                catch (ArgumentOutOfRangeException e)
                {

                    Console.WriteLine(e.Message);
                }
                catch (FormatException)
                {
                    Console.WriteLine("You didnt enter a valid number");
                }
                catch (ArgumentNullException)
                {
                    Console.WriteLine("You cannot enter null value");
                }
            
            }
        }
    }
}
